package cn.zyy.hotel.dao;

import cn.zyy.hotel.entity.Employee;
import cn.zyy.hotel.vo.EmployeeVO;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;

import java.util.List;

public interface EmployeeMapper {

    //根据登录账号查询员工信息
    Employee selectEmployeeByLoginName(@Param("loginName") String loginName);

    //根据部门编号查询员工数量
    int getEmployeeCountByDeptId(Integer deptId);

    //根据角色编号查询员工数量
    int getEmployeeCountByRoleId(Integer roleId);

    //查询员工列表
    List<Employee> selectEmployeeList(EmployeeVO employeeVo);

    //添加员工
    int addEmployee(Employee employee);

    //修改员工
    int updateEmployee(Employee employee);

    //删除员工
    int deleteById(Integer id);

    //删除员工角色关系数据
    void deleteEmployeeAndRole(Integer id);

    //保存员工角色关系数据
    @Insert("insert into sys_role_employee (eid,rid) values(#{eid},#{rid})")
    void addEmployeeRole(@Param("rid") String roleId,@Param("eid") Integer empId);

    //根据id查询员工
    Employee selectEmployeeById(Integer id);
}
